package com.yanqu.road.entity.activity.apprentice.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_apprentice_level")
public class ApprenticeLevelConfig {

    @FieldTypeAnnotation(desc = "活动ID", select = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "id", update = true)
    private int id;

    @FieldTypeAnnotation(desc = "升到下一级经验")
    private int exp;

    @FieldTypeAnnotation(desc = "单次行程项目数")
    private int projectNum;

    @FieldTypeAnnotation(desc = "单次可选择的项目数")
    private int chooseNum;

    @FieldTypeAnnotation(desc = "权重")
    private String weight;
    private List<Integer> weightList;

    @FieldTypeAnnotation(desc = "消耗体力量")
    private int consume;

    @FieldTypeAnnotation(desc = "小考间隔")
    private int testInterval;

    @FieldTypeAnnotation(desc = "小考测试参数")
    private long testParam;

    @FieldTypeAnnotation(desc = "天资奖励")
    private String testReward;
    private List<Integer> testRewardList = new ArrayList<>();

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getExp() {
        return exp;
    }

    public void setExp(int exp) {
        this.exp = exp;
    }

    public int getProjectNum() {
        return projectNum;
    }

    public void setProjectNum(int projectNum) {
        this.projectNum = projectNum;
    }

    public int getChooseNum() {
        return chooseNum;
    }

    public void setChooseNum(int chooseNum) {
        this.chooseNum = chooseNum;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
        List<Integer> weightList = new ArrayList<>();
        for (String w : weight.split("\\|")) {
            weightList.add(Integer.parseInt(w));
        }
        this.weightList = weightList;
    }

    public int getConsume() {
        return consume;
    }

    public void setConsume(int consume) {
        this.consume = consume;
    }

    public List<Integer> getWeightList() {
        return weightList;
    }

    public int getTestInterval() {
        return testInterval;
    }

    public void setTestInterval(int testInterval) {
        this.testInterval = testInterval;
    }

    public long getTestParam() {
        return testParam;
    }

    public void setTestParam(long testParam) {
        this.testParam = testParam;
    }

    public String getTestReward() {
        return testReward;
    }

    public void setTestReward(String testReward) {
        this.testReward = testReward;
        if (!StringUtils.isNullOrEmpty(testReward)) {
            this.testRewardList = StringUtils.stringToIntegerList(testReward, "\\|");
        }
    }

    public List<Integer> getTestRewardList() {
        return testRewardList;
    }
}
